$ ls
Helloworld.txt README.md
$ rm Helloworld.txt && ls
README.md
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: Helloworld.txt
no changes added to commit (use "git add" and/or "git commit -a")
git add
,把東西給增加到暫存區(Staging Area)裡面$ git add .
$ git commit -m "Delete Doc Helloworld"
$ git commit -m "Delete doc Helloworld"
[master 55cf8d6] Delete doc Helloworld
1 file changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 Helloworld.txt
$ ls
Helloworld.txt README.md
$ git status
On branch master
Your branch is ahead of 'origin/master' by 3 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
git rm XXXXX
$ git rm Helloworld.txt
rm 'Helloworld.txt'
$ git status
On branch master
Your branch is ahead of 'origin/master' by 3 commits.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: Helloworld.txt
Helloworld.txt
換成 Byeworld.txt
$ ls
Helloworld.txt README.md
$ mv Helloworld.txt Byeworld.txt
$ ls
Byeworld.txt README.md
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: Helloworld.txt
Untracked files:
(use "git add <file>..." to include in what will be committed)
Byeworld.txt
no changes added to commit (use "git add" and/or "git commit -a")
$ git add .
$ git commit -m "Del Helloworld & Add Byeworld"
[master 16e1d92] Del Helloworld & Add Byeworld
1 file changed, 0 insertions(+), 0 deletions(-)
rename Helloworld.txt => Byeworld.txt (100%)
$ ls
Helloworld.txt README.md
$ git mv Helloworld.txt Byeworld.txt
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
renamed: Helloworld.txt -> Byeworld.txt
$ git add .
$ git commit -m "Del Helloworld & Add Byeworld"
[master e9d6fe7] Del Helloworld & Add Byeworld
1 file changed, 0 insertions(+), 0 deletions(-)
rename Helloworld.txt => Byeworld.txt (100%)
明天我們在繼續看別的狀況啦~